<?php
namespace app\admin\model;

use think\Model;

class ItemsModel extends Model
{
    
    protected $auto = ['update_time'];
    protected $insert = ['create_time'];
    protected $update = [];
    
    protected function setCreateTimeAttr()
    {
        return date('Y-m-d H:i:s');
    }
    
    protected function setUpdateTimeAttr()
    {
        return date('Y-m-d H:i:s');
    }
    
    public function site()
    {
        return $this
        ->hasOne('SiteModel','items_id')
        ->bind('items_id,name,map,address,mobile,content,city_id,img,detail_pics,top_pics,is_official,is_index')
        ->setEagerlyType(0);
    }
    
    public function space()
    {
        return $this
        ->hasOne('SpaceModel','items_id')
        ->bind('items_id,name,space_cate,map,address,people,mobile,content,city_id,img,detail_pics,top_pics,is_official,is_index')
        ->setEagerlyType(0);
    }
}